<template>
  <div>

    <template v-for="item in tree_data">
    
      <el-submenu
        :key="item._id"
        :index="item._id"
        v-if="item.children&&item.children.length>0&&item.children[0].menuType.toString()==='1'"
      >
        <template slot="title">
          <i :class="item.icon"></i>
          <span>{{item.menuname}}</span>
        </template>
        <TreeMenu :tree_data="item.children"></TreeMenu>
      </el-submenu>
      
       <el-menu-item
        :key="item._id"
        :index="item.path"
        v-else-if="item.menuType.toString()==='1'"
      >
        {{item.menuname}}
       

      </el-menu-item>
      <!-- <el-menu-item-group>
          <template slot="title">分组一</template>
          <el-menu-item index="1-1">选项1</el-menu-item>
          <el-menu-item index="1-2">选项2</el-menu-item>
        </el-menu-item-group>
        <el-menu-item-group title="分组2">
          <el-menu-item index="1-3">选项3</el-menu-item>
        </el-menu-item-group>
        <el-submenu index="1-4">
          <template slot="title">选项4</template>
          <el-menu-item index="1-4-1">选项1</el-menu-item>
      </el-submenu>-->
    </template>
  </div>
</template>
<script>
export default {
  name: "TreeMenu",
  props: {
    tree_data: Array,
    default: () => {
      return [];
    }
  },

};
</script>